package com.example.demo.controller;

import com.example.demo.controller.data.ReturnData;
import com.example.demo.entity.Comment;
import com.example.demo.service.CommentService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * 评论相关的接口控制类
 *
 */
@RestController
@RequestMapping("/comment")
public class CommentController {

    @Resource
    CommentService commentService;

    // 圈子评论接口
    @PostMapping("/add")
    public ReturnData add(@RequestBody Comment comment, HttpServletRequest request) {
        String token = request.getHeader("token");
        return  commentService.add(comment,token);
    }

    // 获取圈子评论接口
    @GetMapping("/getCommentList")
    public ReturnData getCommentList(int circleId) {
        return  commentService.getCommentList(circleId);
    }



}
